The content of Hypertext Transfer Protocol (HTTP) messages is transmitted within the application layer (“Layer 7”) of the Open Systems Interconnection (OSI) model (ISO/IEC 7498-1), and may also be referred to as web application layer data. The OSI model was developed to establish standardization for linking heterogeneous communication systems, and describes the flow of information from a software application of a first computer system to a software application of a second computer system through a communications network. The OSI model has seven functional layers including a physical link layer, a data link layer, a network layer, a transport layer, a session layer, a presentation layer, and an application layer. A few examples of application layer protocols include, but are not limited to, HTTP for web application communication, File Transfer Protocol (FTP) for file transmission, Internet Message Access Protocol (IMAP) and Post Office Protocol (POP) for email, Simple Mail Transfer Protocol (SMTP) for transmitting email, Internet Relay Chat (IRC) for real-time Internet text messaging, Session Initiation Protocol (SIP) for voice and video calling, and Network File System (NFS) for the remote access of files.
Another model detailing communications on the Internet is known as the Internet Protocol (IP) suite, and is sometimes referred to as “TCP/IP”. In contrast to the OSI model, the Internet protocol suite is a set of communications protocols including four layers: a link layer, an internet layer, a transport layer, and an application layer. The link layer of the Internet protocol suite, which provides communication technologies for use in a local network, is often described as roughly analogous to a combination of the data link layer (layer 2) and physical layer (layer 1) of the OSI model. The internet layer (e.g., IP version 4 (IPv4), IP version 6 (IPv6)) of the Internet protocol suite, which provides for inter-networking and thus connects various local networks, is often described as roughly analogous to the network layer (layer 3) of the OSI model. The transport layer (e.g., Transmission Control Protocol (TCP), User Datagram Protocol (UDP)) of the Internet protocol suite, which allows for host-to-host communications, is often described as roughly analogous to the transport layer (layer 4) of the OSI model. Finally, the application layer of the Internet protocol suite includes the various protocols (e.g., HTTP, IMAP, FTP, SIP) for data communications on a process-to-process level, and is often described as analogous to a combination of the session, presentation, and application layers (layers 5-7, respectively) of the OSI model.
Regardless of the model considered, many common attacks are targeted at aspects of the network layer, the transport layer, and the application layer. The network layer, which is under the transport layer and routes data supplied by the transport layer, manages delivery of packets between computing devices that may be connected to different networks and separated by one or more other networks. The network layer is responsible for logical addressing, which includes managing mappings between IP addresses and computing devices on a worldwide basis. The network layer is also responsible for ensuring that packets sent to computing devices on different networks are able to successfully navigate through the various networks successfully and arrive at the proper intended destinations. Network devices such as routers and gateways predominantly operate at the network layer. The transport layer, which is under the application layer, provides end-to-end communication services by providing reliable delivery of an entire message from a source to a destination, sometimes using multiple packets. While the network layer typically handles each packet independently, the transport layer manages the relationships between the packets to ensure that the entire message arrives at the destination and can be reassembled in the correct order to recreate the original message. The application layer typically operates as the top layer in networking models and carries application-specific data, such as HTTP request and response messages.
Application layer attacks typically target web applications executed by web application servers (in which case, they are referred to as web application layer attacks). A web application server is system software (running on top of an operating system) executed by server hardware upon which web applications run. Web application servers may include a web server (e.g. Apache, Microsoft® Internet Information Server (IIS), nginx, lighttpd), which delivers web pages on the request of HTTP clients using HTTP, and may also include an application server that executes procedures (i.e., programs, routines, scripts) of a web application. Web application servers typically include web server connectors, computer programming language libraries, runtime libraries, database connectors, and/or the administration code needed to deploy, configure, manage, and connect these components. Web applications are computer software applications made up of one or more files including computer code that run on top of web application servers and are written in a language the web application server supports. Web applications are typically designed to interact with HTTP clients by dynamically generating HTML responsive to HTTP request messages sent by those HTTP clients. Many web applications utilize databases (e.g., relational databases such as PostgreSQL, MySQL, and Oracle, and non-relational databases, also known as NoSQL databases, such as MongoDB, Riak, CouchDB, Apache Cassandra and HBase) to store information received from HTTP clients and/or information to be displayed to HTTP clients.
HTTP clients interact with web applications by transmitting HTTP request messages to web application servers, which execute portions of web applications and return web application data in the form of HTTP response messages back to the HTTP clients, where the web application data may be rendered using a web browser. Thus, HTTP functions as a request-response protocol in a client-server computing model, where the web application servers typically act as the “server” and the HTTP clients typically act as the “client.”
HTTP Resources are identified and located on a network by Uniform Resource Identifiers (URIs)—or, more specifically, Uniform Resource Locators (URLs)—using the HTTP or HTTP Secure (HTTPS) URI schemes. URLs are specific strings of characters that identify a particular reference available using the Internet. URLs typically contain a protocol identifier or scheme name (e.g. http, https, ftp), a colon, two slashes, and one or more of user credentials, server name, domain name, IP address, port, resource path, query string, and fragment identifier, which may be separated by periods and/or slashes. The original versions of HTTP—HTTP/0.9 and HTTP/1.0—were revised in Internet Engineering Task Force (IETF) Request For Comments (RFC) 2616 as HTTP/1.1, which is in common use today. A new version of the HTTP protocol, HTTP/2.0, is currently being developed by the Hypertext Transfer Protocol Bis (httpbis) working group of the IETF and is based upon the SPDY protocol. As HTTP/2.0 is expected to similarly utilize HTTP clients and HTTP request messages, the ideas discussed herein should largely (if not entirely) remain applicable to HTTP/2.0.
By way of an operational example, an HTTP client requests a web page from a web application server by sending it an HTTP request message. For example, to access the web page with a URL of “http://www.example.org/index.html”, web browsers connect to the web application server at www.example.org by sending it an HTTP request message using a “GET” method, which looks like the following:
GET /index.html HTTP/1.1
Host: www.example.org
The web application server replies by sending a set of HTTP headers along with the requested web page, which collectively is called an HTTP response message.
A HTTP message may include request lines, status lines, HTTP headers, a message body, and/or a trailer. Request lines, which are used in HTTP/1.1 request messages, include a method token field that identifies a method to be performed (e.g., “GET”, “POST”), a Request URI field that identifies a URI of a resource upon which to apply the method (i.e., a requested URL), and a protocol version field (e.g., “HTTP/1.1”). Status lines, which are used in HTTP/1.1 response messages, include a protocol version field, a numeric status code field (e.g., 403, 404), and an associated textual explanatory phrase field (e.g., “Forbidden”, “Not Found”). HTTP headers define the operating parameters of an HTTP transaction, and each HTTP header typically comprises a colon-separated name-value pair.
One type of HTTP header is a “Referer” header that allows a web browser to specify, for a web application server's benefit, an address (e.g., URI) of a resource (e.g., web page) from which the requested URI was obtained. For example, if a user clicks on a link from within a web page having a URI of “http://www.example.com/index.html”, the resulting HTTP request message sent by the web browser may include a Referer header of “Referer: http://www.example.com/index.html” indicating that the HTTP request message was originated from that web page. Another type of HTTP header is a “User-Agent” header that indicates, for the web application server's benefit, what software and/or modules are utilized by the HTTP client making the request. For example, a User-Agent header may include one or more of a web browser product name and version number, a layout engine name and version number used by the web browser, an identifier of the type of machine and/or operating system of the user, and/or names of any extensions utilized by the web browser. For example, a User-Agent header transmitted from the Mozilla® Firefox® web browser executing on a computer utilizing the Microsoft® Windows® 7 operating system may be “Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2) Gecko/20100115 Firefox/3.6”. A core set of HTTP fields for “HTTP/1.1” is standardized by the IETF in RFC 2616, and other updates and extension documents (e.g., RFC 4229). Additional field names and permissible values may be defined by each application.
HTTP parameters are typically short pieces of data (i.e., attribute name and attribute value pairs) that are sent from the HTTP client to the web application server. HTTP parameters may be sent a variety of ways, such as including them in the Request URI of the request line of an HTTP request message utilizing the HTTP “GET” method (i.e., by tacking them on the end of the Request URI as a “query string”), or by including them in the message body of the HTTP request message when using the HTTP “POST” method. In principle, the HTTP GET method requests the contents of a particular URL, while the HTTP POST method “sends” data to a particular URL. By way of example, assume the below HTML form is provided to the HTTP client as part of a web page:
 <form action=″http://www.examplesite.com/login″ method=“get”><input type=text name=″username″><input type=submit></form>
Responsive to this HTML form being displayed, a user may enter the username “mcjones” and submit this form, which causes the HTTP request parameter “?username=mcjones” to be tacked on the end of the URL to form http://www.examplesite.com/login?username=mcjones. In this example, “username” is deemed a field name or attribute name or attribute identifier, and “mcjones” can be deemed a user-entered value of the field/attribute or an attribute value.
In addition to sending user-submitted form data, HTTP request messages may also be used for other purposes, including: 1) to send data via some Application Programming Interface (API) to call a web application server; and 2) to send data to AJAX (Asynchronous JavaScript and XML) web applications. While formerly any user action required a web page to be reloaded from the web application server, AJAX allows an HTTP client to retrieve data from the web application server asynchronously in the background without interfering with the display and behavior of the existing page. For example, an AJAX call may load new content into a web page after the initial rendering of the page without having to reload or “refresh” the page (i.e., transmit another HTTP request for the web page and/or render the entire page once again).
Structured Query Language (SQL) is a special-purpose programming language allowing for declarative querying of data (typically) contained in a relational database. Relational databases model data storage using one or more tables having columns and rows storing values associated with the columns. Most SQL implementations include data insert commands (e.g., INSERT), query commands (e.g., SELECT), update commands (e.g., UPDATE), and delete (e.g., DELETE) commands, as well as schema creation, schema modification, and data access control commands. While relational databases are often referred to as SQL databases, other types of (non-relational) databases exist that are often referred to as NoSQL databases.
Many web applications utilize databases, both relational and non-relational, to store and provide data used by the web application, including but not limited to user data (passwords, user names, contact information, credit card information, web application history, etc.) and other site-specific data including but not limited to stories, comments, pictures, product information, sales information, financial records, and any other type of information utilized by or displayed by a web application. Because these databases often store confidential or private information, the databases are often configured to only provide access to the data stored therein to a limited number of users, geographic locations, and/or computing devices. For example, many databases are configured to only allow access to a particular web application server.
However, due to the sensitive and important data in these databases, they are often targeted by third parties seeking unauthorized, and possibly malicious, access. For example, attackers may attempt to perform SQL Injection (SQLi) attacks (a form of web application layer attack, which is a form of application layer attack) by sending carefully crafted HTTP request messages to a web application server that may cause the web application to interact with its database under the direction of the attacker. While SQL injection attacks can be prevented through careful construction of web applications—for example, by validating and/or sanitizing (e.g., escaping) input provided to the web application by its users—such careful construction is not always used during the construction of all web applications.
In addition to SQLi attacks, many other types of attacks target web applications and web application users. For example, Cross-Site Request Forgery (CSRF) attacks work by abusing the trust between a web application and a particular client to perform an application level transaction on behalf of the attacker using the identity of the client. Further, attackers may use Remote File Inclusion (RFI) attacks that target web application servers, Cross-Site Scripting attacks, Clickjacking attacks (i.e., User Interface Redress Attacks), and many other web application layer attacks. Web application layer attacks typically come from outside a network (e.g. a Local Area Network (LAN)) and are directed at one or more computing devices within that network. For example, SQL injection attacks are typically directed at web applications and databases executing on computing devices located within a LAN and come from computing devices located outside the LAN.
Given this reality, security devices (sometimes called web application firewalls) are commonly utilized to look for and prevent such attacks within HTTP traffic (i.e. web application layer traffic).
FIG. 1 is a diagram illustrating aspects of security rules for detecting attacks of certain attack types existing in the prior art according to certain embodiments of the invention. In FIG. 1, a set of rules 150 is illustrated that can be utilized in an attack detector or other type of firewall type module for examining network traffic (e.g., packets). While each of the rules 150 may be implemented in a variety of ways known to those of skill in the art, the rules 150 are conceptually presented herein as including several distinct aspects. First, each rule includes a rule identifier (ID) 100, which serves to uniquely identify a particular rule. Each rule ID 100 can be a unique set of bits or characters serving as a “key” to the set of rules 150, and in many systems the rule IDs 100 are integer values, string values (sets of one or more characters), or even combinations of other aspects of the rules. In some systems, however, an explicit rule ID 100 is not necessary.
The set of rules 150 also includes a set of one or more conditions 108 that define what to look for in traffic, and a set of one or more actions 106 to be performed when a condition 108 is met. The condition 108 includes, for each rule, one or more attributes 107. An attribute 107 is a combination of an attribute identifier 102 and a set of one or more attribute values 104. An attribute identifier 102 serves to identify how to determine a particular attribute value to be examined. Attribute identifiers 102 can identify particular protocol headers (e.g., a TCP header, an HTTP header) and/or header fields (e.g., a source or destination port of a TCP header, a Referer HTTP header field) used within a packet. Attribute identifiers 102 can also identify metrics or characteristics of traffic that an attribute value 104 represents. For example, an attribute identifier 102 may be a number of packets or HTTP messages received over a defined period of time, and the corresponding attribute value 104 may be that particular number of packets or HTTP messages. Of course, the use of metrics or characteristics as attribute identifiers 102 requires that the system have some way of determining the attribute values 104, perhaps by maintaining a separate table or database (not pictured) with relevant data necessary to perform the computation. Attribute identifiers 102 may also identify portions of application layer data carried by packets, such as an HTTP request message, an HTTP response message, a SQL query, etc. Each of the rules 150 may include one or more attribute IDs 102, and for each of the attribute IDs 102, a set of one or more attribute values 104. In some systems, each rule may also include detection logic 101 describing how the attribute identifiers 102 and attribute values 104 are to be used. For example, in some systems the detection logic 101 defines logic statements to define the relations within a pair of attribute IDs 102 and associated sets of attribute values 104 (e.g., only one of the values 104 must be found, all of the values 104 must be found, or none of the values 104 must be found), and/or to define the relations between different pairs of attribute IDs 102 and associated attribute values 104 (e.g., a first ID-value pair must be true AND a second ID-value pair must be true, a first ID-value pair must be true OR a second ID-value pair must be true). In some systems, the detection logic 101 instead defines how to find the portions of the traffic identified by the attribute identifiers 102. However, in some systems, the detection logic 101 and attributes 107 (including attribute identifiers 102 and associated attribute values 104) are combined into fewer fields.
Each of the rules 150 is also depicted as including one or more actions 106 to be performed when the condition 108 of the rule is satisfied. Actions 106 can indicate one or more forwarding actions (e.g., drop the packet or message, temporarily hold the packet or message for further analysis, transmit the packet or message to a particular module or IP address, forward the packet or message to the intended destination) or modification actions (e.g., insert a value into the packet or message at a particular location, strip out a value from the packet or message, replace a value in the packet or message, etc.). The actions 106 can also include instructions describing what information is to be placed into each alert package; for example, an action may direct that an attack type indication of “RFI attack” is to be included therein. Additionally, many other types of actions are well known to those of ordinary skill in the art, and thus these examples are not exhaustive.
In some systems, the rules 150 utilized by computing devices for security purposes may be described as detecting a particular type of attack and thus have an attack type 130. For example, a first rule 110 may detect SQLi attacks and be of a SQLi attack type, a second rule 112 may detect RFI attacks and be of an RFI attack type, a third rule 114 may detect denial of service (DoS) attacks and be of a DoS attack type, and a fourth rule 116 may detect CSRF attacks and thus be of a CSRF attack type.